package com.ruoyi.web.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.domain.dto.GangdanAppraiseParamDto;
import com.ruoyi.web.domain.dto.GongdanConfirmParamDto;
import com.ruoyi.web.service.GangDanConfirmAndAppraiseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description: WorkFormConfirmAndAppriseController
 * @auth fcb
 * @date 2025-03-10 17:16
 **/
@RestController
@RequestMapping("/work-form/confirmAndApprise")
@Api(tags = "工单确认与评价接口")
public class WorkFormConfirmAndAppriseController {

    @Autowired
    private GangDanConfirmAndAppraiseService gangDanConfirmAndAppraiseService;

    @PostMapping("/confirmWorkForm")
    @ApiOperation("工单处理后，综合管理部确认工单处理")
    public AjaxResult confirmWorkForm(@RequestBody GongdanConfirmParamDto paramDto) {
        gangDanConfirmAndAppraiseService.updateGongDanConfirm(paramDto);
        return AjaxResult.success();
    }

    @PostMapping("/appraiseWorkForm")
    @ApiOperation("工单处理后，用户评价工单处理情况")
    public AjaxResult appraiseWorkForm(@RequestBody GangdanAppraiseParamDto paramDto) {
        gangDanConfirmAndAppraiseService.addGongDanAppraise(paramDto);
        return AjaxResult.success();
    }

    @GetMapping("/getGongDanConfirm")
    @ApiOperation("根据工单id查询工单确认信息")
    public AjaxResult getGongDanConfirmVoById(@RequestParam("baseId") Long baseId) {
        return AjaxResult.success(gangDanConfirmAndAppraiseService.queryGongDanConfirmVoById(baseId));
    }

    @GetMapping("/getGangDanAppraise")
    @ApiOperation("根据工单id查询工单评价信息")
    public AjaxResult getGangDanAppraiseVoById(@RequestParam("baseId") Long baseId) {
        return AjaxResult.success(gangDanConfirmAndAppraiseService.queryGangDanAppraiseVoById(baseId));
    }
}
